   <?php
	@$jzid = $_REQUEST["jzid"];
	@$yy = "已结账";
	
@$czid= $_REQUEST["czid"];

function dd($jzid,$yy,$czid){
$pdo=new PDO("mysql:dbname=caipin;host=127.0.0.1;charset=UTF8","root","root");

$sql0=$pdo->prepare("delete  from zhuocai where zhuoId=:czid ");
$sql0->execute(array("czid" => $czid ));

 $sql = $pdo->prepare("select * from dindan where did=:id");
    $sql->execute(array("id" => $jzid));
    $jg = $sql->fetch(PDO::FETCH_NAMED);
if (!empty($jg)) {	
    $sql3=$pdo->prepare("update dindan set jz=:k where  did=:id ");  
 $isok= $sql3->execute(array("id" => $jzid ,"k"=>$yy ));
if($isok){
echo  "结账成功";
header("Refresh:1;url=dindanjilu.php");
}else{ 
echo  "结账失败";
}


	}
}



	
if (!empty($jzid)) {
   dd($jzid, $yy,$czid);
}
	
	

?>
